package com.ltmall.api.parse;

import com.ltmall.api.comm.Path;
import com.ltmall.api.parse.bean.CompetitionMember;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class CrazyCompetitionMemberParse {
    /**
     * 商品图片的路径
     */
    static String photoPath = Path.nginx_server_dir_client + Path.PHOTO + File.separator;

    /**
     * 订单列表列表的解析
     *
     * @param list list
     * @return List<CompetitionMember>
     */
    public static List<CompetitionMember> memberListParse(List<?> list) {
        List<CompetitionMember> memberList = new ArrayList<CompetitionMember>();
        for (int i = 0; i < list.size(); i++) {
            Object[] obj = (Object[]) list.get(i);

            CompetitionMember member = new CompetitionMember();
            member.setUserID(Integer.parseInt(obj[0].toString()));
            member.setUserPhone(obj[1].toString());
            member.setOpTime(Long.parseLong(obj[2].toString()));
            member.setUserPhoto(photoPath + ((obj[3] == null) ? null : obj[3].toString()));
            member.setTime(obj[4].toString());

            memberList.add(member);
        }

        return memberList;
    }

}
